package avicit.bdp.dcs.semistructure.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 异步删除文件数据失败记录表(bdp_dcs_async_file)
 */
@ApiModel(value = "AsyncFileDTO", description = "bdp_dcs_async_file")
@Table(name = "bdp_dcs_async_file")
public class AsyncFileDTO extends BaseDTO {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 文件路径
     */
    @LogField
    @ApiModelProperty(value = "文件路径")
    @FieldRemark(column = "file_path", field = "filePath", name = "文件路径")
    @Column(name = "file_path")
    private String filePath;

    // 状态，未删除：1、删除中：2、删除失败：3
    @LogField
    @ApiModelProperty(value = "状态，未删除：1、删除中：2、删除失败：3")
    @FieldRemark(column = "status", field = "status", name = "状态")
    @Column(name = "status")
    private Integer status;

    // 总待删除记录
    @LogField
    @ApiModelProperty(value = "总待删除记录")
    @FieldRemark(column = "total_records", field = "totalRecords", name = "总待删除记录")
    @Column(name = "total_records")
    private Long totalRecords;

    /**
     * 组织机构代码
     */
    @ApiModelProperty(value = "组织机构代码")
    @FieldRemark(column = "org_identity", field = "orgIdentity", name = "组织机构代码")
    @Column(name = "org_identity")
    private String orgIdentity;

    /**
     * 密级
     */
    @ApiModelProperty(value = "密级")
    @FieldRemark(column = "secret_level", field = "secretLevel", name = "密级")
    @Column(name = "secret_level")
    private String secretLevel;

    // 删除进度
    @ApiModelProperty(value = "删除进度")
    @Transient
    private String deleteProgress;

    // 文件名
    @ApiModelProperty(value = "文件名")
    @Transient
    private String fileName;

    public AsyncFileDTO(Builder builder) {
        this.id = builder.id;
        this.filePath = builder.filePath;
        this.orgIdentity = builder.orgIdentity;
        this.secretLevel = builder.secretLevel;
    }

    public AsyncFileDTO(){

    }

    public static Builder builder() {
        return new Builder();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Long getTotalRecords() {
        return totalRecords;
    }

    public void setTotalRecords(Long totalRecords) {
        this.totalRecords = totalRecords;
    }

    public String getDeleteProgress() {
        return deleteProgress;
    }

    public void setDeleteProgress(String deleteProgress) {
        this.deleteProgress = deleteProgress;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    @Override
    public String getOrgIdentity() {
        return orgIdentity;
    }

    @Override
    public void setOrgIdentity(String orgIdentity) {
        this.orgIdentity = orgIdentity;
    }

    @Override
    public String getSecretLevel() {
        return secretLevel;
    }

    @Override
    public void setSecretLevel(String secretLevel) {
        this.secretLevel = secretLevel;
    }

    @Override
    public String toString() {
        return "AsyncFileDTO{" +
                "id='" + id + '\'' +
                ", filePath='" + filePath + '\'' +
                ", orgIdentity='" + orgIdentity + '\'' +
                ", secretLevel='" + secretLevel + '\'' +
                '}';
    }

    public static class Builder{
        private String id;
        private String filePath;
        private String orgIdentity;
        private String secretLevel;

        public Builder id(String id) {
            this.id = id;
            return this;
        }
        public Builder filePath(String filePath) {
            this.filePath = filePath;
            return this;
        }
        public Builder orgIdentity(String orgIdentity) {
            this.orgIdentity = orgIdentity;
            return this;
        }
        public Builder secretLevel(String secretLevel) {
            this.secretLevel = secretLevel;
            return this;
        }
        public AsyncFileDTO build() {
            return new AsyncFileDTO(this);
        }
    }

}